package com.zcg.blogger.pojo;

import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Range;

import com.sun.istack.internal.NotNull;

public class User {
	private int id;
	private String username;
	private String password;
	private String email;
	
	public User(){
		
	}
	
	public User(int id, String userName, String password, String email) {
		super();
		this.id = id;
		this.username = userName;
		this.password = password;
		this.email = email;
	}
	
	@NotEmpty(message="用户名不能为空")
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Size(min=1,max=10,message="密码的长度应该在1到10之间")
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Email(message="邮箱的格式不正确")
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", userName=" + username + ", password="
				+ password + ", email=" + email + "]";
	}
}
